import { Injectable } from '@nestjs/common';
import { CreateIdCardDto } from './dto/create-id-card.dto';
import { UpdateIdCardDto } from './dto/update-id-card.dto';
import { InjectEntityManager, InjectRepository } from '@nestjs/typeorm';
import { IdCard } from './entities/id-card.entity';
import { User } from 'src/user/entities/user.entity';
import { Repository } from 'typeorm';

@Injectable()
export class IdCardService {
  @InjectRepository(IdCard)
  private readonly idCardRepository: Repository<IdCard>;

  // @InjectRepository(User)
  // private readonly userRepository: Repository<User>;

  async create(createIdCardDto: CreateIdCardDto) {
    // const findUser = this.userRepository.findOne
    // createIdCardDto. = findUser;
    const res = await this.idCardRepository.save(createIdCardDto);
    return res;
  }

  findAll() {
    return `This action returns all idCard`;
  }

  findOne(id: number) {
    return `This action returns a #${id} idCard`;
  }

  update(id: number, updateIdCardDto: UpdateIdCardDto) {
    return `This action updates a #${id} idCard`;
  }

  remove(id: number) {
    return `This action removes a #${id} idCard`;
  }
}
